package ru.study.thinkin.chapter13;

import java.util.*;

abstract class Shape {
	void  draw() {
		System.out.println(this +".draw()");
	}
	abstract public String toString();
}
class Circle extends Shape {
	@Override
	public String toString() {
		return "Circle";
	}		
}

class Square extends Shape {
	@Override
	public String toString() {
		return "Square";
	}		
}

class Triagle extends Shape {
	@Override
	public String toString() {
		return "Triagle";
	}	
}

public class Shapes {
	
	public static void main(String[] args) {
	List<Shape> shapeList = new ArrayList(Arrays.asList(new Circle(),new Triagle()));
	shapeList.add(new Square());
	for(Shape shape:shapeList)
		shape.draw();
	}

}
